package com.mao.service.impl.store;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mao.dao.store.UserDao;
import com.mao.model.store.Store;
import com.mao.model.user.User;
import com.mao.model.user.UserVO;
import com.mao.service.store.IUserService;

@Service("userService")
public class UserServiceImpl implements IUserService<User>{
	
	private UserDao userDao;
	
	
	public User getUserById(long id){
		return userDao.getUserById(id);
	}
	
	public User login(String loginName, String password){
		return userDao.login(loginName, password);
	}
	
	public Store getStoreofUser(Long storeId){
		return userDao.getStoreofUser(storeId);
	}
	
	public List<User> getUsersOfStore(UserVO userVO, Integer page, Integer rows){
		return userDao.getUsersOfStore(userVO, page, rows);
	}
	
	public int getUsersCountOfStore(UserVO userVO, Integer page, Integer rows){
		return userDao.getUsersCountOfStore(userVO, page, rows);
	}

	public void saveUser(User user){
		userDao.saveUser(user);
	}
	
	public void updateUser(User user){
		userDao.updateUser(user);
	}
	
	public boolean isHasChildren(Long id){
		return userDao.isHasChildren(id);
	}
	
	public void deleteUser(Long id){
		userDao.deleteUser(id);
	}
	
	public boolean isLoginNameUsed(String loginName){
		return userDao.isLoginNameUsed(loginName);
	}
	
	
	
	
	
	public UserDao getUserDao() {
		return userDao;
	}
	@Autowired
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}
	
	
}
